#ifndef ACTIVITYITEMMODEL_H
#define ACTIVITYITEMMODEL_H

#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVariant>
#include <QObject>
#include "ActivityItem.h"
#include "ActivityItemType.h"
class ActivityItemType;

class ActivityItemModel : public QAbstractItemModel
{
    Q_OBJECT

public:
    enum ActivityItemModelRoles
    {
        ActivityItemModelRoleName = Qt::UserRole + 1,
        ActivityItemModelContextName,
        ActivityItemModelDescription,
        ActivityItemModelFlaged
    }x;
    explicit ActivityItemModel(QList<QVariant> headData, QObject *parent = nullptr);
    ~ActivityItemModel();

    // Header:
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;

    bool setHeaderData(int section, Qt::Orientation orientation, QVariant &value, int role = Qt::EditRole) ;

    // Basic functionality:
    QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
    QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE;

    int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
    int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;

    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;

    // Editable:
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
    QVariant setActivityTypeData(const ActivityItemType &value);
    Qt::ItemFlags flags(const QModelIndex& index) const Q_DECL_OVERRIDE;

    // Add data:
    bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
    bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;

    // Remove data:
    bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
    bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;

private:
    ActivityItem *rootItem;
    QHash<int, QByteArray> m_roleNameMaping;
};

#endif // ACTIVITYITEMMODEL_H
